home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / mslang / mfcvbx / mfcvbx.h_ / mfcvbx.h
Encoding:
C/C++ Source or Header  |  1994-06-07  |  9.2 KB  |  316 lines

  1. // 
  2. // $Id$
  3. //
  4. // Module    :     mfcvbx.h
  5. //
  6. // Author    :     James Bish
  7. //
  8. // Date        :     06/15/93
  9. //
  10. // $Log$
  11. //
  12. // Copyright (c) Bish Programming 1993 - All Rights Reserved.
  13. //
  14.  
  15. #include <afxwin.h>
  16. #include <afxcoll.h>
  17. #include <afxdlgs.h>
  18.  
  19. #ifndef __MFCVBX_H__
  20. #define __MFCVBX_H__
  21.  
  22. #include "vbxmsg.h"
  23.  
  24. //
  25. // Class CVBCtlWnd
  26. //    
  27. class CVBCtlWnd : public CWnd
  28. {   
  29.     DECLARE_DYNAMIC(CVBCtlWnd)
  30.     
  31. public:
  32.     HCTL     m_hCtl;
  33.  
  34.     CVBCtlWnd();    
  35.     CVBCtlWnd(HWND hwnd);     
  36.     LRESULT DefWindowProc(UINT msg,WPARAM wp,LPARAM lp);
  37.     void PostNcDestroy() {delete this;} 
  38.     afx_msg void OnSize(UINT nType, int cx, int cy);
  39.     
  40.     LRESULT WindowProc(USHORT msg,WPARAM wp,LPARAM lp)    
  41.      {   return  CWnd::WindowProc(msg,wp,lp);     }    
  42. protected:       
  43.     //
  44.     // Functions for VBAPI Message Processing.
  45.     //
  46.             
  47.     afx_msg void OnPaint();
  48.     
  49.     afx_msg LRESULT OnVBCancelMode(WPARAM wp, LPARAM lp);
  50.     afx_msg LRESULT OnVBCheckProperty(WPARAM wp, LPARAM lp);
  51.     afx_msg LRESULT OnVBCopy(WPARAM wp, LPARAM lp);
  52.     afx_msg LRESULT OnVBCreated(WPARAM wp, LPARAM lp);
  53.     afx_msg LRESULT OnVBDragDrop(WPARAM wp, LPARAM lp);
  54.     afx_msg LRESULT OnVBDragOver(WPARAM wp, LPARAM lp);
  55.     afx_msg LRESULT OnVBFireEvent(WPARAM wp, LPARAM lp);
  56.     afx_msg LRESULT OnVBGetDefSize(WPARAM wp, LPARAM lp);
  57.     afx_msg LRESULT OnVBGetPalette(WPARAM wp, LPARAM lp);
  58.     afx_msg LRESULT OnVBGetProperty(WPARAM wp, LPARAM lp);
  59.     afx_msg LRESULT OnVBGetPropertyHsz(WPARAM wp, LPARAM lp);
  60.     afx_msg LRESULT OnVBHelp(WPARAM wp, LPARAM lp);
  61.     afx_msg LRESULT OnVBHitTest(WPARAM wp, LPARAM lp);
  62.     afx_msg LRESULT OnVBInitialize(WPARAM wp, LPARAM lp);
  63.     afx_msg LRESULT OnVBInitPropPopup(WPARAM wp, LPARAM lp);
  64.     afx_msg LRESULT OnVBIsMnemonic(WPARAM wp, LPARAM lp);
  65.     afx_msg LRESULT OnVBLinkEnumFormats(WPARAM wp, LPARAM lp);
  66.     afx_msg LRESULT OnVBLinkGetData(WPARAM wp, LPARAM lp);
  67.     afx_msg LRESULT OnVBLinkGetItemName(WPARAM wp, LPARAM lp);
  68.     afx_msg LRESULT OnVBLinkSetData(WPARAM wp, LPARAM lp);
  69.     afx_msg LRESULT OnVBLoaded(WPARAM wp, LPARAM lp);
  70.     afx_msg LRESULT OnVBLoadProperty(WPARAM wp, LPARAM lp);
  71.     afx_msg LRESULT OnVBLoadTextProperty(WPARAM wp, LPARAM lp);
  72.     afx_msg LRESULT OnVBMethod(WPARAM wp, LPARAM lp);
  73.     afx_msg LRESULT OnVBMnemonic(WPARAM wp, LPARAM lp);
  74.     afx_msg LRESULT OnVBPaint(WPARAM wp, LPARAM lp);
  75.     afx_msg LRESULT OnVBPaintMultiSel(WPARAM wp, LPARAM lp);
  76.     afx_msg LRESULT OnVBPaintOutline(WPARAM wp, LPARAM lp);
  77.     afx_msg LRESULT OnVBPaletteChanged(WPARAM wp, LPARAM lp);
  78.     afx_msg LRESULT OnVBPaste(WPARAM wp, LPARAM lp);
  79.     afx_msg LRESULT OnVBQPasteOk(WPARAM wp, LPARAM lp);
  80.     afx_msg LRESULT OnVBSaveProperty(WPARAM wp, LPARAM lp);
  81.     afx_msg LRESULT OnVBSaveTextProperty(WPARAM wp, LPARAM lp);
  82.     afx_msg LRESULT OnVBSetProperty(WPARAM wp, LPARAM lp);
  83.     afx_msg LRESULT OnVBWantSpecialKey(WPARAM wp, LPARAM lp);
  84.     
  85.     afx_msg LRESULT OnVBCharToItem(WPARAM wp, LPARAM lp);
  86.     afx_msg LRESULT OnVBCtlCommand(WPARAM wp, LPARAM lp); // CtlCommand instead of Command due to conflict with MFC
  87.     afx_msg LRESULT OnVBCompareItem(WPARAM wp, LPARAM lp);
  88.     afx_msg LRESULT OnVBCtlColor(WPARAM wp, LPARAM lp);
  89.     afx_msg LRESULT OnVBDeleteItem(WPARAM wp, LPARAM lp);
  90.     afx_msg LRESULT OnVBDrawItem(WPARAM wp, LPARAM lp);
  91.     afx_msg LRESULT OnVBHScroll(WPARAM wp, LPARAM lp);
  92.     afx_msg LRESULT OnVBMeasureItem(WPARAM wp, LPARAM lp);
  93.     afx_msg LRESULT OnVBParentNotify(WPARAM wp, LPARAM lp);
  94.     afx_msg LRESULT OnVBVKeyToItem(WPARAM wp, LPARAM lp);
  95.     afx_msg LRESULT OnVBVScroll(WPARAM wp, LPARAM lp);        
  96.  
  97.     DECLARE_MESSAGE_MAP()     
  98. };                            
  99.  
  100.  
  101. //
  102. // Class to put a wrapper around the VBAPI PROPINFO structure.
  103. //
  104. class CVBCtlPropInfo : public CObject {
  105. public:
  106.     // Constructors       
  107.                   
  108.     CVBCtlPropInfo(PROPINFO NEAR *StdProp);
  109.                       
  110.     CVBCtlPropInfo(PSTR npszName, FLONG fl,
  111.         BYTE offsetData, LONG dataDefault = -1, PSTR npszEnumList = NULL,
  112.         BYTE enumMax = -1);
  113.         
  114.     
  115.     ~CVBCtlPropInfo();        
  116.     
  117.     // Operations       
  118.     
  119.     PROPINFO NEAR *GetProperty() { return m_thePropInfo; }
  120. private:
  121.     int              m_allocated;
  122.     PROPINFO NEAR *m_thePropInfo;
  123. };    
  124.  
  125. //
  126. // Class for a list of CVBCtlPropInfo objects.
  127.  
  128. class CVBCtlPropInfoList : public CObList {
  129. };
  130.  
  131. //
  132. // Class to put a wrapper around the VBAPI PEVENTINFO structure.
  133. //
  134. class CVBCtlEventInfo : public CObject {
  135. public:
  136.     // Constructors       
  137.                   
  138.     CVBCtlEventInfo(EVENTINFO NEAR *StdEvent);
  139.                       
  140.     CVBCtlEventInfo(PSTR npszName, USHORT cParams = 0,
  141.         USHORT cwParams = 0, PWORD npParamTypes = NULL, 
  142.         PSTR npszParamProf = NULL,
  143.         FLONG fl = 0L);               
  144.         
  145.     ~CVBCtlEventInfo();        
  146.         
  147.     // Operations       
  148.     
  149.     EVENTINFO NEAR *GetEvent() { return m_theEventInfo; }
  150.  
  151. private:
  152.     int                m_allocated;
  153.     EVENTINFO NEAR     *m_theEventInfo;
  154. };
  155.  
  156. //
  157. // Class to create a list of CVBCtlPEventInfo objects.
  158. //
  159. class CVBCtlEventInfoList : public CObList {
  160. };
  161.  
  162. //
  163. // Class to put a wrapper around the VBAPI MODEL structure.
  164. //
  165.                         
  166. class CVBCtlModel : public CObject {
  167. public:
  168.     // Constructors
  169.         
  170.     CVBCtlModel(USHORT usVersion, FLONG fl, PCTLPROC pctlproc,
  171.         FSHORT fsCalssStyle, FLONG flWndStyle, USHORT cbCtlExtra,
  172.         USHORT idBmpPalette, PSTR npszDefCtlName, PSTR npszDefClassName,
  173.         PSTR npszParentClassName,
  174.         BYTE nDefProp, BYTE npDefEvent,
  175.         BYTE nValueProp, CRuntimeClass *theclass);
  176.     
  177.     CVBCtlModel(USHORT usVersion, FLONG fl, PCTLPROC pctlproc,
  178.         FSHORT fsCalssStyle, FLONG flWndStyle, USHORT cbCtlExtra,
  179.         USHORT idBmpPalette, PSTR npszDefCtlName, PSTR npszDefClassName,
  180.         CRuntimeClass *theclass);
  181.     
  182.     ~CVBCtlModel();
  183.  
  184.     void SetParentWindowClass(char *ParentWindowClass = NULL);                                     
  185.     void SetDefProp(BYTE nDefProp = -1, BYTE nValueProp = -1);                                     
  186.     void SetDefEvent(BYTE nDefEvent = -1);        
  187.     
  188.     char *GetParentWindowClass();
  189.     BYTE GetDefProp();         
  190.     BYTE GetDefEvent();
  191.  
  192.     void     SetCtlModelProc() { }
  193.     MODEL     *GetCtlModel() { return m_Model; }    
  194.     MODEL     *GetCtlModel(char *CtlName)
  195.         { return m_Model; }   
  196.         
  197.     CRuntimeClass *GetCtlClass() { return &m_Class; }
  198.     void     SetCtlClass(CRuntimeClass theclass) 
  199.         { m_Class = theclass; }        
  200.         
  201.     //
  202.     // Functions to Handle the sublists.
  203.     //
  204.                                 
  205.     void AddProperty(PROPINFO NEAR *StdProp);
  206.                                     
  207.     void AddProperty(PSTR npszName, FLONG fl,
  208.         BYTE offsetData, LONG dataDefault = -1, PSTR npszEnumList = NULL,
  209.         BYTE enumMax = -1);
  210.                             
  211.     void AddEvent(EVENTINFO NEAR *StdEvent);
  212.     
  213.     void AddEvent(PSTR npszName, USHORT cParams = 0,
  214.         USHORT cwParms = 0, PWORD npParmTypes = NULL, PSTR 
  215.         npszParmProf = NULL,
  216.         FLONG fl = 0L );
  217.         
  218.     void SetProperties();        
  219.     void SetEvents();
  220.     void SetParentClassNameAllocated() { ParentClassNameAllocated = TRUE; }
  221.  
  222. private:
  223.     int                        ParentClassNameAllocated;
  224.     CRuntimeClass            m_Class;
  225.     MODEL                    *m_Model;                    
  226.     CVBCtlPropInfoList         m_proplist;
  227.     CVBCtlEventInfoList     m_eventlist;
  228. };
  229.  
  230. class CVBCtlModelList : public CObList {
  231. };
  232.  
  233. //
  234. // Class CVBDLL - The vbx dll application object.
  235. //
  236. class CVBDLL : public CWinApp                   
  237. {
  238. public:
  239.     //
  240.     // Construction  / Destruction.
  241.     //
  242.     
  243.     CVBDLL();
  244.     
  245.     ~CVBDLL();
  246.                     
  247.     //
  248.     // Model, Property, and Event Methods
  249.     //
  250.                           
  251.     void AddModel(char *CtlName, FLONG fl, FSHORT fsClassStyle, 
  252.         FLONG flWndStyle, USHORT cbCtlExtra, USHORT idBmpPalette, 
  253.         PSTR npszParentClassName = NULL,
  254.         BYTE nDefProp = -1, BYTE nDefEvent = -1, BYTE nValueProp = -1,
  255.         CRuntimeClass *theclass = NULL);        
  256.  
  257.        void AddModel(char *CtlName, FLONG fl, FSHORT fsClassStyle, 
  258.         FLONG flWndStyle, USHORT cbCtlExtra, USHORT idBmpPalette, 
  259.         CRuntimeClass *theclass = NULL);        
  260.  
  261.     void SetParentWindowClass(char *CtlName, char *ParentWindowClass = NULL);                                     
  262.     void SetDefProp(char *CtlName, BYTE nDefProp = -1, BYTE nValueProp = -1);                                     
  263.     void SetDefEvent(char *CtlName, BYTE nDefEvent = -1);        
  264.     
  265.     char *GetParentWindowClass(char *CtlName);
  266.     BYTE GetDefProp(char *CtlName);         
  267.     BYTE GetDefEvent(char *CtlName);
  268.                  
  269.     void AddProperty(char *CtlName, PROPINFO NEAR *StdProp );
  270.                               
  271.     void AddProperty(char *CtlName, PSTR npszName, FLONG fl,
  272.         BYTE offsetData, LONG dataDefault = -1, PSTR npszEnumList = NULL,
  273.         BYTE enumMax = -1);
  274.  
  275.     void AddEvent(char *CtlName, EVENTINFO NEAR *StdEvent );
  276.         
  277.     void AddEvent(char *CtlName, PSTR npszName, USHORT cParms = 0,
  278.         USHORT cwParms = 0, PWORD npParmTypes = NULL, 
  279.         PSTR npszParmProf = NULL, FLONG fl = 0L);
  280.                                                
  281.     //
  282.     // Methods for popup window creation control.
  283.     //
  284.                                                    
  285.     int  IsPopupWnd() { return m_PopupWndStat; }
  286.     void SetPopupWnd(BOOL val) { m_PopupWndStat = val; }
  287.  
  288.     //
  289.     // Private Data Access Methods
  290.     //
  291.     
  292.     CVBCtlModel *GetFirst();
  293.     CVBCtlModel *GetNext();
  294.     CVBCtlModel *FindModel( char *CtlName );
  295.     
  296.     CRuntimeClass *GetCtlClass(MODEL FAR *lpmodel);
  297.     
  298.     //
  299.     // Initialization Methods.
  300.     //
  301.     
  302.     int  InitInstance();
  303.     int  ExitInstance();    
  304.     
  305. private:
  306.     CVBCtlModelList        m_ModelList;
  307.     int                    m_PopupWndStat;    
  308.     POSITION            pos;
  309. };   
  310.  
  311. #endif // __MFCVBX_H__
  312.  
  313.  
  314.  
  315.  
  316.